package tech.wetech.admin.modules.system.web;

import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import tech.wetech.admin.core.utils.Result;
import tech.wetech.admin.modules.base.query.PageQuery;
import tech.wetech.admin.modules.base.web.BaseCrudController;
import tech.wetech.admin.modules.system.po.WXPay;
import tech.wetech.admin.modules.system.service.WXPayService;

import java.util.List;

/**
 * @author lu
 * @description
 * @date 2019年09月05日 14:08
 */
@Controller
@RequestMapping("/weixin")
public class WXPayController extends BaseCrudController<WXPay> {

    @Autowired
    private WXPayService wxPayService;

    @GetMapping
    public String wxpay() {
        return "system/wxpay";
    }

    @GetMapping("/selectlist")
    @ResponseBody
    public Result queryList(WXPay wxPay, PageQuery pageQuery) {
        List<WXPay> list = wxPayService.querySelectList(wxPay, pageQuery);
        return Result.success(list)
                .addExtraIfTrue(pageQuery.isCountSql(), "total", ((Page) list).getTotal());
    }
}
